package action.agent;

import org.apache.struts2.ServletActionContext;

import service.interf.IIfwRechargeInfo;
import action.common.MyBaseAction;

import com.opensymphony.xwork2.ModelDriven;

import dao.interf.IIfwRechargeInfoDAO;
import dao.pojo.IfwRechargeInfo;

/**
 * 点卡使用情况
 * 
 * @author Administrator
 * 
 */
public class IfwRechargeInfoAction extends MyBaseAction<IfwRechargeInfo>
		implements ModelDriven<IfwRechargeInfo> {

	private static final long serialVersionUID = 1L;
	private IIfwRechargeInfo iIfwRechargeInfo;
	private IIfwRechargeInfoDAO iIfwRechargeInfoDAO;

	public IIfwRechargeInfo getiIfwRechargeInfo() {
		return iIfwRechargeInfo;
	}

	public void setiIfwRechargeInfo(IIfwRechargeInfo iIfwRechargeInfo) {
		this.iIfwRechargeInfo = iIfwRechargeInfo;
	}

	public IIfwRechargeInfoDAO getiIfwRechargeInfoDAO() {
		return iIfwRechargeInfoDAO;
	}

	public void setiIfwRechargeInfoDAO(IIfwRechargeInfoDAO iIfwRechargeInfoDAO) {
		this.iIfwRechargeInfoDAO = iIfwRechargeInfoDAO;
	}

	public IfwRechargeInfoAction() {
		super(IfwRechargeInfo.class);
	}

	public IfwRechargeInfo getModel() {
		return model;
	}

	/**
	 * 初始化列表
	 */
	public void getlist() {
		String x = "";
		try {
			x = iIfwRechargeInfo.findByProperty("IfwRechargeInfo", "*", "json",
					true, new String[] { "sn" },
					new Object[] { model.getSn() }, null, null,
					model.getPage(), model.getRows());
		} catch (Exception e) {
			x = errorHandle.handleErr(e);
		}
		servletHandle.writeToClient(ServletActionContext.getResponse(), x);
	}

	/**
	 * 初始化列表
	 */
	public void getbycardnum() {
		String x = "";
		try {
			x = iIfwRechargeInfo.findByCardNum(model.getCardNum());
		} catch (Exception e) {
			x = errorHandle.handleErr(e);
		}
		servletHandle.writeToClient1(ServletActionContext.getResponse(), x);
	}
}
